

module.exports = class extends baseController{
    constructor(){
        super();
        this.adminUserLogic=this.loadLogic('iframe/admin-user');
        this.router.post('/getUserInfo',this.getUserInfo.bind(this));
        this.router.post('/ReSetPwd',this.ReSetPwd.bind(this));
        return this.router;
    }

    static init(){
        return new this();
    }

    async getUserInfo(req,res){
        let ret={};
        try{
            let UserInfo= await this.adminUserLogic.getLoginUserInfo(req.user);
            ret=this.Success(1,UserInfo);
        }
        catch(err){
            ret=this.Error('操作失败',err);
        }
        res.json(ret);
    }

    async ReSetPwd(req,res){
        let Result = {};
        try {
            let newPwd = req.body.RePwd;
            let ret= await this.adminUserLogic.resetPwd(req.user.UserID,newPwd);
            Result=this.Success(1,ret);
        } catch (err) {
            Result=this.Error('操作失败',err);
        }
        res.json(Result);
    }
};

